home *** CD-ROM | disk | FTP | other *** search
-
- ┌───────────────────────────────────────────────────────────────╖
- │■ ■ ║
- │ ║
- │ █████████░ ██░ ║
- │ ██░ ██░ ██░ ██░ ██████░ ██░ ████████░ ██░ ██░ ║
- │ ██░ ██░ ██░ ██░ ██░ ██░ ██░ ██░ ██░ ██░ ║
- │ ██░ ██░ ██░ ██░ ██░ ██░ ████████░ ██░ ██░ ║
- │ ██░ ██░ ██░ ██░ ██░ ██░ ██░ ██░ ██░ ██░ ██░ ║
- │ █████████░ ████████░ ██░ ██████░ ██░ ██░ ███░ ███░ ║
- │ ║
- │ T ∙ R ∙ I ∙ A ∙ D ║
- │■ ■ ║
- ╘═══════════════════════════════════════════════════════════════╝
- ╔══════════════╗
- ║ ∙ PRESENTS ∙ ║
- ╚══════════════╝
-
- 3D-Starfields In Turbo Pascal
- ───────────────────────────────────────────────────────────────────────────────
- Code By : Vulture Total Files : 4
- File Type : 3d-stars source Release Date : 20th of October '95
- Difficulty : Easy level Filename : VGA-VUL5.ARJ
- ───────────────────────────────────────────────────────────────────────────────
-
- Hey there! Vulture here typing this little textfile. Yeah, another Outlaw
- Triad release has hit yar screen. I just found an old little program on
- 3d starfields floating around my harddisk somewhere. I coded it some time
- ago and I thought "Well, what da heck... maybe somebody finds it usefull".
- So here it is! A new Outlaw release flushed into space (3d space that is ;-)
-
- ───────────────────────────────────────────────────────────────────────────────
-
- Well, I am aware that a 3d starfield is probably the most used routine in
- da whole width demo-scene (after the scroller;-) so I am not about to
- explain it here. Hey! If you really want to learn how to code gfx, study
- this source. It really isn't very difficult. But what you must know are
- the formulas needed to display a 3d starfield on yar screen. Here they are:
-
- NX := ((Stars.X shl 7) div Stars.Z) + Xoff;
- NY := ((Stars.Y shl 7) div Stars.Z) + Yoff;
-
- A star is build up by 3 coordinates, namely X,Y and Z. In order to show
- 3d-points on the screen, you must to some calculations first. In this case
- it's very simple.
- To get the vga's X value, multiply the stars X value with 256 and then
- divide it by it's Z value. Then add the Xoff, which is 160, to center it on
- the screen. The vga Y value is calculated in the same matter. That's it!
- The Stars.X is a random value between -160 and 160. The Stars.Y is a random
- value between -100 and 100. The Z-value starts with 255.
- Next, decrease the Z-value so the stars move towards the viewer. Or increase
- it so they move away from the viewer. There, I explained it to ya after all!
-
- Next thing to do is make a program which shows not just one, but a variety
- of 3d-stars. A single star does not create a starfield, now does it... ;-)
- Take a look at the program to see how this can be done.
-
- ───────────────────────────────────────────────────────────────────────────────
-
- Study the source and learn. But I've got one thing to say... I'm getting
- pretty sick and tired of all those lamers stealing source-code and then
- saying it's theirs (won't mention names...)! I mean, coders do not release
- their stuff so others can take the credit for it. They release it so otha
- people can learn from it and create demos/intros of their own. If you use
- other peoples sourcecode, then say so and credit them. Best thing is to get
- ideas from source-codes and code fcts yourselve.
-
- Btw, thanx to Denthor of Aphyxia for giving me a hint on these starfields.
-
- Well, that's it. Go and study the source and if you can, try to make some
- improvements on it. This source really isn't a hot piece of code so... ;-)
-
- If ya wanna contact Outlaw for some reason, call Blue Nose Productions and
- leave a message there. We are stated in the main menu!
-
- Ok, gotta dash now, bye...
-
- Vulture / Outlaw Triad
-
- ───────────────────────────────────────────────────────────────────────────────
- OUTLAW DISTROS
-
- ■ The Force ■ ■ Blue Nose Prod ■ ■ FireHouse ■
- ■ +31 (0)36-5346967 ■ ■ +31 (0)345-619401 ■ ■ +31 (0)528-274176 ■
-
- Open For More!
- ───────────────────────────────────────────────────────────────────────────────
- OUTLAW GREETZ
-
- DemoLisher (back in business), Ash (nice releases), Kr'33 (keep da gfx
- coming), Troop (coding a bbs together), Utter Chaos (at full speed),
- Thunderhawk (fanatic as always), all contacts on internet (you know
- who U R), and all otha (demo)groups around.... Bye!
- ───────────────────────────────────────────────────────────────────────────────